using UnityEngine;
using System.Collections;

public class introPavimento : MonoBehaviour 
{
    int id = 15;

    void Start()
    {

    }

    void OnMouseDown()
    {
        Application.LoadLevel(3);
		Popularidade.dinheiro -= 30;
    }

    void Update()
    {
        if (Game.introPavimentoBool == true)
        {
            this.gameObject.AddComponent("MeshRenderer");
            this.gameObject.AddComponent("MeshFilter");
            this.gameObject.AddComponent("BoxCollider");
            this.gameObject.GetComponent<BoxCollider>().size = new Vector3(3, 2, 0);
            this.gameObject.tag = "introPavimento";

            Mesh mesh = Quad.Create(1.5f, 0.8f);

            this.gameObject.GetComponent<MeshFilter>().mesh = mesh;
            this.gameObject.GetComponent<MeshRenderer>().material = AtlasManager.globalMaterial;

            this.gameObject.GetComponent<MeshFilter>().mesh.uv = new Vector2[]
        {
           new Vector2(AtlasManager.rects[id].xMin, AtlasManager.rects[id].yMax),
           new Vector2(AtlasManager.rects[id].xMax, AtlasManager.rects[id].yMax),
           new Vector2(AtlasManager.rects[id].xMax, AtlasManager.rects[id].yMin),
           new Vector2(AtlasManager.rects[id].xMin, AtlasManager.rects[id].yMin)
        };

            this.transform.position = new Vector3(0.9301724f, -1.837058f, 0);
        }
    }
}
